package iso3.pt.action;

import iso3.pt.model.Alumno;
import iso3.pt.model.Asignatura;
import iso3.pt.service.PtDaoService;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;


/**
 * <p> Validate a user login. </p>
 */
public class SubjectMarkingAction  extends ActionSupport implements Preparable {
	private static final long serialVersionUID = 1L;
	private Alumno student;
	private Asignatura subject;
	private int subjectID;
	private int studentDNI;
	private String concept;
	private float mark;

	public String execute() throws Exception {		
		return SUCCESS;
	}
	
	public String submitMark() {
		PtDaoService dao = new PtDaoService();
		dao.addEvaluacion(concept, mark, subjectID, studentDNI);
		return "showStudentSubjectMarks";
	}
	
	@Override
	public void prepare() throws Exception {
		PtDaoService dao = new PtDaoService();
		student = dao.getAlumno(studentDNI);
		subject = dao.getAsignatura(subjectID);
	}

	public Alumno getStudent() {
		return student;
	}

	public void setStudent(Alumno student) {
		this.student = student;
	}

	public Asignatura getSubject() {
		return subject;
	}

	public void setSubject(Asignatura subject) {
		this.subject = subject;
	}

	public int getStudentDNI() {
		return studentDNI;
	}

	public void setStudentDNI(int studentDNI) {
		this.studentDNI = studentDNI;
	}

	public int getSubjectID() {
		return subjectID;
	}

	public void setSubjectID(int subjectID) {
		this.subjectID = subjectID;
	}

	public String getConcept() {
		return concept;
	}

	public void setConcept(String concept) {
		this.concept = concept;
	}

	public float getMark() {
		return mark;
	}

	public void setMark(float mark) {
		this.mark = mark;
	}

}
